
import ac = module("utils/commons/array-collection");

	
/**
	* The list of valid attachment levels.
	* 
	* @author Xavier Sosnovsky, Anthony Morel
	*/
export class AttachmentLevel {
		
	/*==============================Fields================================*/
		
	private static _instance:AttachmentLevel;
		
	private static _attachmentLevels:ac.ArrayCollection<string>;
		
	/*============================Constants===============================*/
		
	/**
	    * Data set level.
	    */
	public static DATASET:string = "DataSet";
	    
	/**
	    * Group level.
	    */
	public static GROUP:string = "Group";
	    
	/**
	    * Series level.
	    */
	public static SERIES:string = "Series";
	    
	/**
	    * Observation level.
	    */
	public static OBSERVATION:string = "Observation";
	    
	/*===========================Constructor==============================*/
		
	constructor(enforcer:SingletonEnforcer) {
	}
	    
	/*==========================Public methods============================*/
	    
	/**
	    * Whether the supplied attachment level is in the list of valid SDMX 
	    * attachment levels.
	    * 
	    * @return true if the supplied attchmentLevel is in the list of valid 
	    * SDMX attachment levels, false otherwise.
	    */ 
	public static contains(attachmentLevel:string):bool {
	    return this.createAttachmentLevelList().contains(attachmentLevel);
	}
	    
	/*=========================Private methods============================*/
	    
	private static createAttachmentLevelList():ac.ArrayCollection<string> {
	    if (null == this._instance) {
	    	this._instance = new AttachmentLevel(new SingletonEnforcer());
            this._attachmentLevels = new ac.ArrayCollection<string>();
            this._attachmentLevels.addItem(AttachmentLevel.DATASET);
            this._attachmentLevels.addItem(AttachmentLevel.GROUP);
            this._attachmentLevels.addItem(AttachmentLevel.SERIES);
            this._attachmentLevels.addItem(AttachmentLevel.OBSERVATION);
	    }
		return this._attachmentLevels;
	}
}

export class SingletonEnforcer {
}